function flooredVal = floorS(val, nS)
    if (val>0)
        flooredVal = floor(val*10^nS)/10^nS;
    elseif (val<0)
        flooredVal = ceil(val*10^nS)/10^nS;
    end
end